package com.ezgo.erc.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 
 * (日志)模块 TODO(访问日志实体类)
 * 
 * @author devintam
 * @date 2015年7月13日 上午9:45:25
 *
 */
public class Syslog extends BaseEntity {

	/**
	 * @Fields serialVersionUID : TODO(序列化)
	 */
	private static final long serialVersionUID = 1L;

	private Long id; // 日志编号
	private String type; // 日志类型（1：接入日志；2：错误日志）
	private Long createBy; // 创建者
	private Date createDate; // 日志创建时间
	private String remoteAddr; // 操作用户的IP地址
	private String requestUrl; // 操作的URl
	private String method; // 操作的方式
	private String params; // 操作提交的数据
	private String userAgent; // 操作用户代理信息
	private String exMsg; // 异常信息

	public Syslog() {
		super();
	}

	public Syslog(String type, Long createBy, String remoteAddr,
			String requestUrl, String method, String params, String userAgent,
			String exMsg) {
		super();
		this.type = type;
		this.createBy = createBy;
		this.createDate = new Date();
		this.remoteAddr = remoteAddr;
		this.requestUrl = requestUrl;
		this.method = method;
		this.params = params;
		this.userAgent = userAgent;
		this.exMsg = exMsg;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Long getCreateBy() {
		return createBy;
	}

	public void setCreateBy(Long createBy) {
		this.createBy = createBy;
	}

	@Column(name = "createTime")
	@Temporal(TemporalType.TIMESTAMP)
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public String getRemoteAddr() {
		return remoteAddr;
	}

	public void setRemoteAddr(String remoteAddr) {
		this.remoteAddr = remoteAddr;
	}

	public String getRequestUrl() {
		return requestUrl;
	}

	public void setRequestUrl(String requestUrl) {
		this.requestUrl = requestUrl;
	}

	public String getMethod() {
		return method;
	}

	public void setMethod(String method) {
		this.method = method;
	}

	public String getParams() {
		return params;
	}

	public void setParams(String params) {
		this.params = params;
	}

	public String getUserAgent() {
		return userAgent;
	}

	public void setUserAgent(String userAgent) {
		this.userAgent = userAgent;
	}

	public String getExMsg() {
		return exMsg;
	}

	public void setExMsg(String exMsg) {
		this.exMsg = exMsg;
	}

}
